#include "StdAfx.h"
#include "GridBtnItem.h"
#include "MemDc.h"
#include "resource.h"

HBITMAP hBmp = (HBITMAP)LoadImage(AfxGetApp()->m_hInstance, "C:\\Users\\Administrator\\Desktop\\belle.bmp", IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE | LR_CREATEDIBSECTION); 
CGridBtnItem::CGridBtnItem(void)
{
	m_pbtmap =new CBitmap;
	m_pbtmap->Attach(hBmp);
}

CGridBtnItem::~CGridBtnItem(void)
{
	m_pbtmap->Detach();
	delete m_pbtmap;
	m_pbtmap =NULL;
}

void CGridBtnItem::OnDarwItem( HDC hDC,const CRect DarwRc )
{
	CGridBaseItem::OnDarwItem(hDC,DarwRc);
	CMemDC mdc(hDC,m_pbtmap);
	BITMAP bmp;
	m_pbtmap->GetBitmap(&bmp);
	TransparentBlt(hDC,DarwRc.left,DarwRc.top,bmp.bmWidth,bmp.bmHeight,mdc.GetGetSafeHDC(), 0, 0, bmp.bmWidth, bmp.bmHeight, RGB(255,255,255));
	//BitBlt(hDC,DarwRc.left,DarwRc.top,DarwRc.Width(),DarwRc.Height(),mdc.GetGetSafeHDC(),0,0,SRCCOPY);
}
